﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="DirectorateList.aspx.cs" Inherits="AB.ServiceDirectory.Design.Directorates.DirectorateList" %>
<%@ Import Namespace="AB.ServiceDirectory" %>
<asp:Content ID="head" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="ContentTitle" ContentPlaceHolderID="ContentTitle" runat="server">
    <h2>Directorate List</h2>
</asp:Content>
<asp:Content ID="Content" ContentPlaceHolderID="Content" runat="server">
        <asp:UpdatePanel ID="UpdatePanelGovOfficeRegion" runat="server">
          <ContentTemplate>
            <div class="grid740 simplebox">
                <div class="titleh">
                    <h3 class="sorting_range">
                        <asp:LinkButton ID="LinkButtonAll" runat="server" CssClass="hg-blue" CommandName="all" OnCommand="FilterByLetters_Command">All</asp:LinkButton>
                        <asp:LinkButton ID="LinkButton09" runat="server" CommandName="09" OnCommand="FilterByLetters_Command">0-9</asp:LinkButton>
                        <asp:LinkButton ID="LinkButtonAE" runat="server" CommandName="ae" OnCommand="FilterByLetters_Command">A B C D E</asp:LinkButton>
                        <asp:LinkButton ID="LinkButtonFJ" runat="server" CommandName="fj" OnCommand="FilterByLetters_Command">F G H I J</asp:LinkButton>
                        <asp:LinkButton ID="LinkButtonKN" runat="server" CommandName="kn" OnCommand="FilterByLetters_Command">K L M N </asp:LinkButton>
                        <asp:LinkButton ID="LinkButtonOR" runat="server" CommandName="or" OnCommand="FilterByLetters_Command">O P Q R</asp:LinkButton>
                        <asp:LinkButton ID="LinkButtonSV" runat="server" CommandName="sv" OnCommand="FilterByLetters_Command">S T U V</asp:LinkButton>
                        <asp:LinkButton ID="LinkButtonWZ" CssClass="last" runat="server" CommandName="wz"
                            OnCommand="FilterByLetters_Command">W X Y Z</asp:LinkButton>
                        <span class="right">
                            <asp:LinkButton ID="LinkButtonCreate" runat="server" CssClass="hg-blue" 
                            onclick="LinkButtonCreate_Click">Create</asp:LinkButton>
                            <asp:CheckBox ID="CheckBoxInactive" runat="server" Text="Include In-active" AutoPostBack="True"
                                OnCheckedChanged="CheckBoxInactive_CheckedChanged" />
                        </span>
                    </h3>
                </div>
                <asp:GridView DataSourceID="ObjectDataSourceDirectorate" ID="GridViewDirectorate" CssClass="tablesorter" runat="server" AutoGenerateColumns="False"
                    AllowPaging="True" PageSize="15" AllowSorting="True">
                    <Columns>
                        <asp:HyperLinkField DataTextField="DirectorateName" 
                            HeaderText="Directorate Name" DataNavigateUrlFields="DirectorateId"
                            DataNavigateUrlFormatString="DirectorateDetails.aspx?DirectorateId={0}" 
                            SortExpression="DirectorateName">
                            <HeaderStyle CssClass="header" />
                        </asp:HyperLinkField>
                        <asp:TemplateField HeaderText="Office Address Line1" SortExpression="Address1">
                            <ItemTemplate>
                                <%# Eval("Address.AddressLine") %>
                            </ItemTemplate>
                            <HeaderStyle CssClass="header" />
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="PostCode" SortExpression="PostCode">
                            <ItemTemplate>
                                <%# Eval("Address.PostCode")%>
                            </ItemTemplate>
                            <HeaderStyle CssClass="header" />
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Contact" SortExpression="ContactName">
                            <ItemTemplate>
                                <%# string.Format("{0} {1}", Eval("Contact.FirstName"), Eval("Contact.SurName")) %>
                            </ItemTemplate>
                            <HeaderStyle CssClass="header" />
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Is Active" SortExpression="IsActive">
                            <ItemTemplate>
                                <%# (bool) Eval("IsActive") ? "Yes" : "No" %>
                            </ItemTemplate>
                            <HeaderStyle CssClass="header" />
                        </asp:TemplateField>
                    </Columns>
                    <PagerStyle CssClass="pagination_table"></PagerStyle>
                </asp:GridView>

        <asp:ObjectDataSource ID="ObjectDataSourceDirectorate" runat="server" SelectMethod="GetDirectorateList"
            TypeName="AB.ServiceDirectory.BO.DirectorateBO" OnSelecting="ObjectDataSourceDirectorate_Selecting"
            EnablePaging="true" SelectCountMethod="GetListCount" StartRowIndexParameterName="startRowIndex"
            MaximumRowsParameterName="maxRows" SortParameterName="sortType" >
            <SelectParameters>
                <asp:Parameter Name="filter" Type="Object" ConvertEmptyStringToNull="False" />
            </SelectParameters>
        </asp:ObjectDataSource>
       </div>
     </ContentTemplate>
   </asp:UpdatePanel>
</asp:Content>
